var API = API || {};

API.x_slider = {

    SliderManager: function (effects_manager, slider_id, list_row) {

        var parent = this;

        // References
        var pager_holder = pager_holder;
        var slider_id = slider_id;
        var list_row = list_row;
        var myFilterMenager;
        var myEffects_manager = effects_manager;

        this.UIValue = function (value) {

            switch (value) {
                case 0:
                    return 0;
                case 50:
                    return 100;
                case 100:
                    return 300;
                case 150:
                    return 500;
                case 200:
                    return 1000;
            }

        };

        this.Init = function (refFilterMenager) {

            parent.myFilterMenager = refFilterMenager;

            $(slider_id).slider({
                animate: true,
                range: "min",
                value: 0,
                min: 0,
                max: 200,
                step: 50,
                change: parent.Change

            });

        };

        this.Change = function (event, ui) {

            var data_id = $(this).attr('data-id');

            var value = parent.UIValue(ui.value);
            $("#" + data_id).html(value);

            myEffects_manager.execEffect(parent.myFilterMenager.doFilter, [data_id, value, value]);

        };
    }
};
